﻿using Stardust.Server;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;

namespace WebNode2
{
    public class User
    {
        public string Name { get; set; }
    }

    [StardustName(Description = "用户服务")]
    public class UserService : IStardustService
    {
        [StardustName(Description = "你好")]
        public string Hello(string name, int count = 1)
        {
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < count; i++)
            {
                sb.AppendFormat("Hello,{0}!{1}", name, Environment.NewLine);
            }
            return sb.ToString();
        }
        public Task<string> HelloAsync()
        {
            return new Task<string>(() =>
            {
                return "Hello World";
            });
        }

        public List<User> UpdateUsers(List<User> list)
        {
            foreach (var user in list)
            {
                user.Name = "Updated:" + user.Name;
            }
            return list;
        }
    }
}